package com.deep.product.controller.web;

import com.deep.product.annotation.ApiController;
import com.deep.product.model.vo.SkuItemVO;
import com.deep.product.service.SkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Deep
 * @date 2022/2/2
 */
@ApiController
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @GetMapping({"/item/{skuId}.html"})
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) {
        SkuItemVO result = skuInfoService.queryItem(skuId);
        model.addAttribute("item", result);
        return "item";
    }
}
